We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.

Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)

Bug 3392534 - Duplicate label makes NASM try to "find valid values" for 1000+ passes
Summary: Duplicate label makes NASM try to "find valid values" for 1000+ passes
Status: CLOSED FIXED
Alias: None
Product: NASM
Classification: Unclassified
Component: Assembler (show other bugs)
Version: 2.14.xx
Hardware: All All
: High critical
Assignee: nobody
URL:
Depends on:
Blocks:
 
Reported: 2018-11-27 12:05 PST by E. C. Masloch
Modified: 2018-12-10 13:38 PST (History)
4 users (show)

Obtained from: From OS distribution
Generated by: ---
Bug category:
Observed for: ---
Regression: ---
Regression since:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description E. C. Masloch 2018-11-27 12:05:18 PST
When there's a duplicate label, NASM 2.14 (from debian repositories) tries for more than 1000 passes to "find valid values for all labels", only then giving up. Also, the error message doesn't refer to the redefinition of the label. (In fact, the error message lacks any line number and is confusingly squashed together.) On a larger project, this process takes more than 4 minutes and gives up after 1014 passes. NASM 2.13.03 (downloaded binary from nasm.us) immediately replies "symbol ... redefined".

Here's a test case:

~/test/nasm/20181127$ cat test.asm 

test1:
	nop

test2:
	nop

test1:
	nop

~/test/nasm/20181127$ nasm -v
NASM version 2.14
~/test/nasm/20181127$ time nasm test.asm
test.asm:error: Can't find valid values for all labels after 1004 passes, giving up.
test.asm:error: Possible causes: recursive EQUs, macro abuse.

real	0m0.176s
user	0m0.168s
sys	0m0.008s
~/test/nasm/20181127$ ./nasm -v
NASM version 2.13.03 compiled on Feb  7 2018
~/test/nasm/20181127$ time ./nasm test.asm 
test.asm:8: error: symbol `test1' redefined

real	0m0.004s
user	0m0.000s
sys	0m0.003s
~/test/nasm/20181127$
Comment 1 H. Peter Anvin 2018-12-07 13:36:40 PST
See also bug 3392535.
Comment 2 Chang S. Bae 2018-12-07 14:32:51 PST
Looks like it begins with the labeling mechanism changes in 2.14:
(98578071: 'Cleanup of label renaming infrastructure, add subsection support')
Comment 3 H. Peter Anvin 2018-12-07 17:20:54 PST
No surprise there. That was a *huge* change, but very necessary for the subsection by label support to actually work.

So if anything was going to break stuff, it would have been that.

I think that what we need to do is to keep track which passn we encountered the definition of a label in, and if it is re-defined in the same passn then that's an error.

I do think it would be nice to allow redefinition *with the same value*, though. Perhaps we could make it a suppressible warning instead of an error.
Comment 4 H. Peter Anvin 2018-12-10 13:38:49 PST
Fixed in release candidate 2.14.01rc2.